import { getArticles, searchArticles } from '@/server/controllers/articleController';
import { getSecuInfo } from '@/server/controllers/secuController';
import { Hono } from 'hono';
export const articleRoutes = new Hono()
    .get('/', async (c) => {
        const articles = await getArticles();
        return c.json(articles, 200);
    })
    .get('/search/:secu_code', async (c) => {
        const { secu_code } = c.req.param();
        const info = await getSecuInfo(secu_code);
        if (info) {
            const secu_name = info.secu_name;
            const articles = await searchArticles(secu_name);
            return c.json(articles, 200);
        }
        return c.json([], 200);
    });
